#include "tcp_client.hpp"
#include <memory>

void Usage(const char *proc)
{
    printf("Usage: %s serverip serverport\n", proc);
}

int main(int argc, char *argv[])
{
    if (argc != 3)
    {
        Usage(argv[0]);
        return 1;
    }
    std::string ip = argv[1];
    uint16_t port = atoi(argv[2]);
    std::unique_ptr<TcpClient> pcli(new TcpClient(ip, port));
    pcli->InitClient();
    pcli->Run();

    // 短服务测试
    // int cnt = 1000;
    // while (cnt--)
    // {
    //     std::unique_ptr<TcpClient> pcli(new TcpClient(ip, port));
    //     pcli->InitClient();
    //     pcli->Run();
    // }
    return 0;
}